package com.chinacoal.microservice.controller;

import com.chinacoal.microservice.WorkOrderClient;
import com.chinacoal.microservice.pojo.CcmsSmartleasingWorkOrder;
import com.chinacoal.microservice.service.WorkOrderService;
import com.chinacoal.microservice.util.PassToken;
import com.chinacoal.microservice.util.QueryCriteria;
import com.chinacoal.microservice.util.Result;
import com.chinacoal.microservice.util.UserLoginToken;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author zhuliang
 * @version V1.0
 * @Description: 运维管理-工单-后端控制类
 * @date 2020-12-16 17：53
 */
@RestController
public class WorkOrderController implements WorkOrderClient {

    @Autowired
    private WorkOrderService workOrderService;

    /**
     * @Description: 查询所有的工单信息（带分页）
     * @author zhuliang
     * @date 2020/12/16 18:01
     */
    @Override
    @UserLoginToken
    public Result<List<CcmsSmartleasingWorkOrder>> getAllByPage(QueryCriteria queryCriteria, String token) {
        return workOrderService.getAllByPage(queryCriteria, token);
    }

    /**
     * @Description: 条件查询所有的工单信息（带分页）
     * @author zhuliang
     * @date 2020/12/16 18:01
     */
    @Override
    @UserLoginToken
    public Result<List<CcmsSmartleasingWorkOrder>> getAllByCondition(QueryCriteria queryCriteria, String token) {
        return workOrderService.getAllByCondition(queryCriteria, token);
    }

    /**
     * @Description: 处理工单信息
     * @author zhuliang
     * @date 2020/12/16 18:37
     */
    @Override
    @UserLoginToken
    public Result handleByWorkOrder(CcmsSmartleasingWorkOrder workOrder, String token) {
        return workOrderService.handleByWorkOrder(workOrder, token);
    }

    /**
     * @Description: 根据工单id查询工单信息
     * @author zhuliang
     * @date 2020/12/16 18:37
     */
    @Override
    @UserLoginToken
    public Result<CcmsSmartleasingWorkOrder> getWorkOrderById(String pkWorkOrderId) {
        return workOrderService.getWorkOrderById(pkWorkOrderId);
    }

}
